package ace.module.account.core.impl.service.biz.impl;

import ace.cmp.core.exception.BusinessException;
import ace.cmp.util.AceAssertUtils;
import ace.module.account.core.impl.service.biz.NickNameBiz;
import org.springframework.stereotype.Component;

/**
 * @author caspar
 * @date 2023/3/20 9:23
 */
@Component
public class NickNameBizImpl implements NickNameBiz {
  public String getByPhone(String phone) {
    AceAssertUtils.isEmpty(phone, "phone 不能为空");
    if (phone.length() < 11) {
      throw new BusinessException("phone 格式不正确");
    }

    return phone.substring(phone.length() - 6);
  }
}
